package com.ctg.payroll2.service.common.impl;

import java.util.ArrayList;
import java.util.List;

import com.ctg.payroll2.bean.common.ColumnModel;
import com.ctg.payroll2.bean.common.StoreField;
import com.ctg.payroll2.bean.filter.payment.PayClazzItemFilter;
import com.ctg.payroll2.dao.payment.PayClazzItemDao;
import com.ctg.payroll2.service.common.PayrollUtilService;
@SuppressWarnings("unchecked")
public class PayrollUtilServiceImpl implements PayrollUtilService {

	private PayClazzItemDao payClazzItemDao;

	public List<ColumnModel> queryColumnModelList(Long payClassId) {
		return payClazzItemDao.getColumnModel(payClassId);
	}
	public List<ColumnModel> queryColumnModelListHis(PayClazzItemFilter	filter) {
		return payClazzItemDao.getColumnModelHis(filter);
	}
	
	public List<StoreField> queryStoreFieldList(Long payClassId) {
		List<StoreField> storeFieldList = new ArrayList();
		List<ColumnModel> columnModelList = payClazzItemDao.getColumnModel(payClassId);
		for (int i = 0; i < columnModelList.size(); i++){
			StoreField storeField = new StoreField();
			storeField.setName(((ColumnModel)columnModelList.get(i)).getDataIndex());
			storeField.setMapping(((ColumnModel)columnModelList.get(i)).getDataIndex());
			storeFieldList.add(storeField);
		}
		
		return storeFieldList;
	}
	public PayClazzItemDao getPayClazzItemDao() {
		return payClazzItemDao;
	}
	public void setPayClazzItemDao(PayClazzItemDao payClazzItemDao) {
		this.payClazzItemDao = payClazzItemDao;
	}
}
